package com.fit.pianosheetshop.beans;

import java.util.*;


import com.fit.pianosheetshop.interfaces.*;
import com.fit.pianosheetshop.service.BorrowUniqueID;
import com.fit.pianosheetshop.service.Borrows;



public class BorrowBean implements Borrow {
	private String id;
	private List<Sheet> sheet;
	private Pianist pianist;
	private Workman workman;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public List<Sheet> getSheet() {
		return sheet;
	}

	public void setSheet(List<Sheet> sheet) {
		this.sheet = sheet;
	}

	public Pianist getPianist() {
		return pianist;
	}

	public void setPianist(Pianist pianist) {
		this.pianist = pianist;
	}

	public Workman getWorkman() {
		return workman;
	}

	public void setWorkman(Workman workman) {
		this.workman = workman;
	}
	public void executeBorrowCreation(Pianist pianist, Workman workman, Sheet sheet, Borrows borrows){
		
		
		this.setId(BorrowUniqueID.getBorrowUniqueID());
		this.setPianist(pianist);
		this.setWorkman(workman);
		List<Sheet> l = new LinkedList<Sheet>();
		l.add(sheet);
		
		this.setSheet(l);
				
		pianist.getBorrow().add(this);
		sheet.getBorrow().add(this);
		pianist.getBorrow().add(this);
		
		borrows.save(this);

	}

}
